<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('设备告警记录列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>设备id：</label>
                                <input type="text" name="eqId"/>
                            </li>
                            <li>
                                <label>设备类型：</label>
                                <select name="eqType">
                                    <option value="">所有</option>
                                    <option value="1">阀门</option>
                                    <option value="2">热表</option>
                                    <option value="3">采集器</option>
                                    <option value="4">室温采集器</option>
                                </select>
                            </li>
                            <li>
                                <label>告警级别：</label>
                                <select name="alarmType">
                                    <option value="">所有</option>
                                    <option value="1">警告</option>
                                    <option value="1">严重</option>
                                </select>
                            </li>
                            <li class="select-time">
                                <label>告警时间： </label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="module:alarm:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "module/alarm";

        $(function() {
            var options = {
                url: prefix + "/list",
                exportUrl: prefix + "/export",
                modalName: "设备告警记录",
                sortName: "createTime",
                sortOrder: "desc",
                columns: [
                {
                    field: 'id',
                    title: '主键id',
                    visible: false
                },
                {
                    field: 'eqId',
                    title: '设备id'
                },
                {
                    field: 'eqType',
                    title: '设备类型',
                    formatter: function (value) {
                        if(value==1){
                            return '阀门';
                        }else if(value==2){
                            return '热表';
                        }else if(value==3){
                            return '采集器';
                        }else if(value==4){
                            return '室温采集器';
                        }
                    }
                },
                {
                    field: 'alarmType',
                    title: '告警级别',
                    formatter: function (value) {
                        if (value==1) {
                            return '<span class="label label-warning">警告</span>';
                        }
                        else if (value==2) {
                            return '<span class="label label-danger">严重</span>';
                        }
                    }
                },
                {
                    field: 'alarmMethod',
                    title: '告警方法'
                },
                {
                    field: 'alarmCode',
                    title: '告警代码'
                },
                {
                    field: 'alarmMsg',
                    title: '告警描述'
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>